<?php 
header("Content-type:text/html;charset=utf-8");
$dir=isset($_GET['d'])?$_GET['d'].'/*':'d:/wamp/www/1*';
echo "<table border='1' width='100%'>";
echo "<tr><td>文件名</td><td>操作</td></tr>";
 ?>
 <?php if (isset($_GET['d'])) {?>
	<a href="javascript:;" onclick="history.go(-1);">返回</a>
<?php 
}
 ?>
 <?php 
foreach (glob($dir) as $file) {
	$basename=basename(iconv('gbk', 'utf-8//IGNORE', $file));
?>
	<tr>
		<td><?php echo $basename; ?></td>
		<td>
			<?php if (is_file($file)) {?>
				<a href="show.php?d=<?php echo $file;?>" target='_blank'>查看
				</a>
			<?php } else{?>
			<a href="files.php?d=<?php echo $file;?>">进入</a>
			<?php } ?>
		</td>
	</tr>

<?php } ?>

 </table>